package com.brother.database;

import com.opensymphony.oscache.base.Cache;
import com.opensymphony.oscache.base.CacheEntry;
import com.opensymphony.oscache.base.EntryRefreshPolicy;

public class OSCacheUtils {

private static Cache cache;	
static{
	cache = new Cache(true, true, true);
}

public static Cache getCache(){
	return cache;
}

public static EntryRefreshPolicy getRefreshPolicy(){
	EntryRefreshPolicy refresh = new EntryRefreshPolicy() {
		
		@Override
		public boolean needsRefresh(CacheEntry ce) {
			long now = System.currentTimeMillis();
			if(now - ce.getLastUpdate() > 1000*360){
				return true;
			}
			return false;
		}
	};
	return refresh;
}

}
